package product

import (
	"fmt"
	"gin/app/http/global"
	"gin/app/http/model/product"
	"github.com/gin-gonic/gin"
	"net/http"
)

func CategoryList(c *gin.Context) {
	var arr []product.Category
	var DB = global.DB
	result := DB.Select("id,name").Find(&arr)
	if result.Error != nil {
		fmt.Println("Failed to retrieve users:", result.Error)
	}
	c.JSON(http.StatusOK, gin.H{
		"code": 1,
		"msg":  "请求成功!",
		"data": arr,
	})
}
